Skip to content

Conversation

@gregfromstl
Copy link
Contributor

@gregfromstl gregfromstl commented Aug 12, 2025


PR-Codex overview

This PR introduces the use of the useActiveAccount hook to enhance the ContractHeaderUI component by conditionally rendering a tooltip and link for contract management based on the active user's account.

Detailed summary

  • Added the useActiveAccount hook to retrieve the active account.
  • Conditionally rendered a ToolTipLabel with a management link if the contract creator matches the active account's address.
  • Updated the button and link structure for contract management.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Summary by CodeRabbit

  • New Features
    • “Manage Contract” action on ERC‑20 public pages is now shown only to the contract owner based on the currently connected account.
    • Non‑owners no longer see the management UI for contracts they don’t own.
    • Tooltip text/behavior unchanged; its container is conditionally rendered by ownership.
    • No changes to public APIs or external behaviors beyond conditional UI visibility.

@gregfromstl gregfromstl requested review from a team as code owners August 12, 2025 02:22
@linear
Copy link

linear bot commented Aug 12, 2025

@changeset-bot
Copy link

changeset-bot bot commented Aug 12, 2025

⚠️ No Changeset found

Latest commit: b1f2de5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Aug 12, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Project Deployment Preview Comments Updated (UTC)
thirdweb-www Ready Preview 💬 Add feedback Aug 12, 2025 2:55am
4 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
docs-v2 ⬜️ Skipped Aug 12, 2025 2:55am
nebula ⬜️ Skipped Aug 12, 2025 2:55am
thirdweb_playground ⬜️ Skipped Aug 12, 2025 2:55am
wallet-ui ⬜️ Skipped Aug 12, 2025 2:55am

@graphite-app
Copy link
Contributor

graphite-app bot commented Aug 12, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 12, 2025

Walkthrough

Added account-aware gating to ContractHeaderUI: imported useActiveAccount, obtained activeAccount, compared it case-insensitively to contractCreator, and conditionally render the “Manage Contract” button/link and tooltip only when the active account equals the creator. No exported APIs changed.

Changes

Cohort / File(s) Summary
Contract header owner-gated UI
apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/ContractHeader.tsx
Import useActiveAccount; compute activeAccount; compare lowercased addresses and render the “Manage Contract” Button+Link with tooltip only when activeAccount.address matches contractCreator (lowercased). Refactored to Button asChild. No public API/signature changes.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant ContractHeaderUI
  participant thirdweb as thirdweb/react (useActiveAccount)

  User->>ContractHeaderUI: Open ERC20 contract page
  ContractHeaderUI->>thirdweb: useActiveAccount()
  thirdweb-->>ContractHeaderUI: activeAccount.address
  ContractHeaderUI->>ContractHeaderUI: compare lowercased(activeAccount.address) == lowercased(contractCreator)
  alt Owner
    ContractHeaderUI-->>User: Render "Manage Contract" Button/Link + tooltip
  else Not Owner
    ContractHeaderUI-->>User: Do not render "Manage Contract" UI
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~6 minutes

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • TEAM-0000: Entity not found: Issue - Could not find referenced Issue.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fc45f7a and b1f2de5.

📒 Files selected for processing (1)
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/ContractHeader.tsx (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/ContractHeader.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Lint Packages
  • GitHub Check: Size
  • GitHub Check: Build Packages
  • GitHub Check: Analyze (javascript)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch greg/mny-99-remove-manage-contract-button-for-end-user

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the Dashboard Involves changes to the Dashboard. label Aug 12, 2025
@codecov
Copy link

codecov bot commented Aug 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.32%. Comparing base (90f36bc) to head (b1f2de5).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7832   +/-   ##
=======================================
  Coverage   56.32%   56.32%           
=======================================
  Files         905      905           
  Lines       58820    58820           
  Branches     4148     4148           
=======================================
  Hits        33133    33133           
  Misses      25581    25581           
  Partials      106      106           
Flag Coverage Δ
packages 56.32% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 12, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 64.03 KB (0%) 1.3 s (0%) 118 ms (+120.1% 🔺) 1.4 s
thirdweb (cjs) 357.38 KB (0%) 7.2 s (0%) 227 ms (+2.58% 🔺) 7.4 s
thirdweb (minimal + tree-shaking) 5.72 KB (0%) 115 ms (0%) 86 ms (+1047.78% 🔺) 200 ms
thirdweb/chains (tree-shaking) 526 B (0%) 11 ms (0%) 39 ms (+1649.32% 🔺) 49 ms
thirdweb/react (minimal + tree-shaking) 19.16 KB (0%) 384 ms (0%) 93 ms (+401.57% 🔺) 477 ms

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/ContractHeader.tsx (2)

176-183: Tighten tooltip copy

Minor clarity/grammar nit: reduce repetition and make the intent clear.

Apply this diff:

-              label={
-                <>
-                  View this contract in thirdweb dashboard to view contract
-                  management interface
-                </>
-              }
+              label={<>Open this contract in the thirdweb Dashboard to manage it.</>}

191-197: Prefer NavLink for internal navigation in dashboard

For internal routes in the dashboard, use NavLink to align with app conventions and get active-state handling for free.

If NavLink is available in the dashboard app, replace this Link with NavLink and update the import accordingly. If not, ignore this suggestion for now and consider standardizing in a follow-up PR.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c661a48 and 738292e.

📒 Files selected for processing (1)
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/ContractHeader.tsx (3 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (CLAUDE.md)

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose

Files:

  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/ContractHeader.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit Inference Engine (CLAUDE.md)

Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)

Files:

  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/ContractHeader.tsx
apps/{dashboard,playground-web}/**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (CLAUDE.md)

apps/{dashboard,playground-web}/**/*.{ts,tsx}: Import UI primitives from @/components/ui/* (Button, Input, Select, Tabs, Card, Sidebar, Badge, Separator) in dashboard and playground apps
Use NavLink for internal navigation with automatic active states in dashboard and playground apps
Use Tailwind CSS only – no inline styles or CSS modules
Use cn() from @/lib/utils for conditional class logic
Use design system tokens (e.g., bg-card, border-border, text-muted-foreground)
Server Components (Node edge): Start files with import "server-only";
Client Components (browser): Begin files with 'use client';
Always call getAuthToken() to retrieve JWT from cookies on server side
Use Authorization: Bearer header – never embed tokens in URLs
Return typed results (e.g., Project[], User[]) – avoid any
Wrap client-side data fetching calls in React Query (@tanstack/react-query)
Use descriptive, stable queryKeys for React Query cache hits
Configure staleTime/cacheTime in React Query based on freshness (default ≥ 60s)
Keep tokens secret via internal API routes or server actions
Never import posthog-js in server components

Files:

  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/ContractHeader.tsx
🧠 Learnings (2)
📚 Learning: 2025-07-18T19:20:32.530Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Interactive UI that relies on hooks (`useState`, `useEffect`, React Query, wallet hooks).

Applied to files:

  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/ContractHeader.tsx
📚 Learning: 2025-05-29T00:46:09.063Z
Learnt from: jnsdls
PR: thirdweb-dev/js#7188
File: apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/accounts/components/accounts-count.tsx:15-15
Timestamp: 2025-05-29T00:46:09.063Z
Learning: In the accounts component at apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/accounts/components/accounts-count.tsx, the 3-column grid layout (md:grid-cols-3) is intentionally maintained even when rendering only one StatCard, as part of the design structure for this component.

Applied to files:

  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/ContractHeader.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Size
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Build Packages
  • GitHub Check: Lint Packages
  • GitHub Check: Unit Tests
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (1)
apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/ContractHeader.tsx (1)

68-68: LGTM: Account-awareness hook usage

Retrieving activeAccount here is appropriate for gating the “Manage Contract” UI.

@gregfromstl gregfromstl force-pushed the greg/mny-99-remove-manage-contract-button-for-end-user branch from 738292e to fc45f7a Compare August 12, 2025 02:37
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground August 12, 2025 02:37 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 August 12, 2025 02:37 Inactive
@vercel vercel bot temporarily deployed to Preview – nebula August 12, 2025 02:37 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui August 12, 2025 02:37 Inactive
@gregfromstl gregfromstl force-pushed the greg/mny-99-remove-manage-contract-button-for-end-user branch from fc45f7a to b1f2de5 Compare August 12, 2025 02:46
@vercel vercel bot temporarily deployed to Preview – nebula August 12, 2025 02:46 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground August 12, 2025 02:46 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui August 12, 2025 02:46 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 August 12, 2025 02:46 Inactive
@gregfromstl gregfromstl merged commit 409ae17 into main Aug 12, 2025
24 checks passed
@gregfromstl gregfromstl deleted the greg/mny-99-remove-manage-contract-button-for-end-user branch August 12, 2025 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Dashboard Involves changes to the Dashboard.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants